package com.kld.data.service.impl;

import com.kld.data.mapper.KettleSqlAboutMapper;
import com.kld.data.service.KettleSqlAboutService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author zhangkai
 * @version 1.0
 * @date 2020/12/30
 * @className KettleSqlAboutServiceImpl
 */
@Service
@Transactional(readOnly = true)
public class KettleSqlAboutServiceImpl implements KettleSqlAboutService {

    private final KettleSqlAboutMapper kettleSqlAboutMapper;

    public KettleSqlAboutServiceImpl(KettleSqlAboutMapper kettleSqlAboutMapper) {
        this.kettleSqlAboutMapper = kettleSqlAboutMapper;
    }

    @Override
    public String findDba01OrDba02MaxLrsj(String tablename) {
        if ("bi_dtk_ys_dba01".equalsIgnoreCase(tablename) || "bi_dtk_ys_dba02".equalsIgnoreCase(tablename)) {
            return kettleSqlAboutMapper.findDba01OrDba02MaxLrsj(tablename);
        }
        throw new RuntimeException("数据库表明不合法：" + tablename);
    }
}
